<?php
/**
 * Template Name: Registration
 */
get_header(); ?>

<div class="container">

    <h1><?php the_title() ?></h1>

    <?php if (is_user_logged_in()) {
    ?>
    <div class="alert">
        <strong>You Are Already Registered as <a style="font-weight:900">
            <?php global $current_user;
            get_currentuserinfo();

            echo $current_user->user_firstname;
            ?>
        </a></strong>
    </div>
    <script>window.location.replace("/my-account/");</script><?
} else {
    ?>
    <div class="row-fluid">
        <div class="span8">
            <div class="card grey clearfix">
                <h2>Sign Up!</h2>

                <p>Welcome to PitchWise! In order to make a booking an account is required, sign up here to get started.</p>
                <hr>

                <form name="registerform" class="form-horizontal" id="registerform">


                    <div class="control-group">
                        <label class="control-label" for="username">Username</label>

                        <div class="controls">
                            <input type="text" name="username" id="username" class="input" value="" size="20" tabindex="10">
                            <span class="help-block"></span>
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="email">Email</label>

                        <div class="controls">
                            <input type="email" name="email" id="email" class="input" value="" size="20" tabindex="10">
                            <span class="help-block"></span>
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="password">Password</label>

                        <div class="controls">
                            <input type="password" name="password" id="password" class="input" value="" size="20" tabindex="10">
                            <span class="help-block">Leave empty to generate password</span>
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="password">First Name</label>

                        <div class="controls">
                            <input type="text" name="first-name" id="first-name" class="input" value="" size="20" tabindex="10">
                            <span class="help-block"></span>
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="password">Last Name</label>

                        <div class="controls">
                            <input type="text" name="last-name" id="last-name" class="input" value="" size="20" tabindex="10">
                            <span class="help-block"></span>
                        </div>
                    </div>

                    <div class="control-group">
                        <div class="controls">
                            <button class="btn btn-primary" type="submit">Submit</button>
                        </div>
                    </div>

                    <input type="hidden" name="action" value="register" style="">


                </form>

                <div class="alert alert-info" id="register-alert" style="display:none">
                    <strong>Warning!</strong> Best check yo self, you're not looking too good.
                </div>

            </div>
        </div>
        <div class="span4">
            <div class="card grey">
            </div>
        </div>
    </div>
    <? } ?>
</div>


<?php get_footer(); ?>

<script src="<?php echo get_template_directory_uri(); ?>/js/PITCHWISE.register.js"></script>

<script>
    $(function () {
        var options = {
            'authenticated': <?php if (is_user_logged_in()) {
            echo 'true';
        } else {
            echo 'false';
        } ?>
        };

        var register = new PITCHWISE.register(options);
    });
</script>